#include <vector>
#include <map>

using namespace std;
class Solution {
public:
    int repeatedNTimes(vector<int>& nums) {
        map<int,int> m;
        for(auto e:nums)
        {
            m[e]++;
        }
        int N = nums.size()/2;
        for(auto e:m)
        {
            if(e.second == N)
            {
                return e.first;
            }
        }
        return -1;
    }
};